<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-with,initial-scale=1.0">
<title>toDoList</title>
<script src="https://unpkg.com/vue@next"></script>
 
</head>
<body>
<div id="root">
 
</div>
 
<script>
Vue.createApp({
    data(){
        return{
            inputValue:'',
            list:[]
        }
    },
        methods:{
            handleAddItem(){
                if(this.inputValue){
                this.list.push(this.inputValue);
                this.inputValue='';
                }
            }
       
        },
        template:`
        <div>
        <input v-model="inputValue" />
        <button v-on:click="handleAddItem">增加项目</button>
           <ul>
           <li v-for="(item,index) of list">{{index}}-{{item}} test</li>
           </ul>
           </div>
        `

}).mount('#root')
</script>
</body>
</html>